#include<iostream>
using namespace std;
int main()
{
	int n,i,a[1001],s[1001]={0},b[1001]={0},k=0,j;
	cin>>n;
	for(i=0;i<n;i++)
	cin>>a[i];
	for(i=n-1;i>=0;i--)
	{
		while(a[i]!=-1)
		{
			a[i]--;		
			k++;
			while(s[k]!=0) k++;
		}
		while(s[k]!=0) k++;	
		s[k]=1;
		b[i]=k-1;
		k=0;
	}
	for(i=0;i<n;i++)
	cout<<b[i]<<" ";
}
